<template>
  <div class="all-boxJ">
 
    <!-- <div class="boxerick3"> -->
      <echarts2 id="echartsJiaoTong1" :option="option6" :styles="styles1"></echarts2>
    <!-- </div> -->
  </div>
</template>

<script>
import echarts from "echarts";
import echarts2 from "@/components/echarts.vue";

export default {
  name: "projectrick",
  props: {
    chartDataOne1: {
      type: Array,
      default: () => {
        return [];
      }
    },

    nameList: {
      type: Array,
      default: () => {
        // return ["桥梁工程", "隧道工程", "路基工程", "临建工程"];
        return [];
      }
    }
  },
  data() {
    var colors = ["#7cf317", "#d10eb1", "#4ddbff"];
    return {
      dateList: ["今日", "本周", "本月"],
      isActive: 0,
      styles1: {
        width: "100%",
        height: "100%",
        margin: "0 auto"
      },
      option6: {
        barWidth: 12,
        // barGap:'80%',
        // legend: {
        //   textStyle: {
        //     color: "#fff"
        //   },
        //   icon: "roundRect", //  字段控制形状  类型包括 circle，rect,line，roundRect，triangle，diamond，pin，arrow，none
        //   itemWidth: 12, // 设置宽度
        //   itemHeight: 6, // 设置高度
        //   itemGap: 10, // 设置间距
        //   // top: 2,
        //   bottom: 0,
        //   left: 50,
        //   // data: ["MQI"]
        // },
        title: {
          text: '**年**月平均交通量',
          top: 2,
          left: 'center',
          textStyle: {
            color: "#fff",
            fontSize: 12
          }
        },
        xAxis: {
          type: "category",
          data: this.nameList,
          // data: ["桥梁工程", "隧道工程", "路基工程", "临建工程"],
          // 去掉y轴坐标线
          axisLine: {
            show: false
          },
          axisTick: {
            show: false
          },
          // 设置字体
          axisLabel: {
            show: true,
            textStyle: {
              color: "#ffffff",
              fontSize: 10
            }
          }
        },

        series: [
          {
            name: "MQI",
            type: "bar",
            // data: [600, 900, 1100, 700],
            data: this.chartDataOne1,
            itemStyle: {
              normal: {
                barBorderRadius: [3, 3, 0, 0],
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: "#44F0FF"
                  },
                  {
                    offset: 1,
                    color: "#3486DA"
                  }
                ])
              }
            }
          }
        ],
        yAxis: [
          {
            type: "value",
            // max : 1200,
            // min: 400,
            splitNumber: 4,
            // 去掉刻度
            axisTick: {
              show: false
            },
            bottom: 10,
            // show : false,
            // 去掉y轴坐标线
            axisLine: {
              show: false
            },
            //网格样式
            splitLine: {
              show: true,
              lineStyle: {
                color: ["#0d1b4b"],
                width: 1,
                type: "solid"
              }
            },
            // 设置字体
            axisLabel: {
              show: true,
              textStyle: {
                color: "#ffffff",
                fontSize: 12
              }
            }
          }
        ],
        // 设置图标的位置
        grid: {
          x: 10,
          x2: 10,
          y:20,
          y2: 30,
          containLabel: true
        }
      }
    }
  },
  components: {
    echarts2
  },
  methods: {
    tabClick(index) {
      this.isActive = index;
    }
  }
};
</script>
<style lang="scss" scoped>
.all-boxJ {
  display: flex;
  .boxerick1 {
    // background: pink;
    width: 38%;
    height: 100%;
    // border-bottom: 0.5px dashed #0ADAFF;
  }
  .boxerick2 {
    // background: pink;
    width: 24%;
    height: 100%;
  }
  .boxerick3 {
    // background: pink;
    width: 38%;
    height: 100%;
  }
  width: 100%;
  height: calc(100% - 24px);
}
</style>
